#include "stdafx.h"
#include "../vfs/FileDeviceHandle.h"
#include "../vfs/FileDevice.h"

namespace ja2{ namespace vfs
{
	FileDevice::FileDevice(FileDeviceHandlePtr_t const &pFileHandle)
		: m_pFileHandle(pFileHandle)
	{
	}

	std::streamsize FileDevice::read(char* s, std::streamsize n)
	{
		return m_pFileHandle->read(s, n);
	}
	
	std::streamsize FileDevice::write(const char* s, std::streamsize n)
	{
		return m_pFileHandle->write(s, n);
	}
	
	boost::iostreams::stream_offset FileDevice::seek(boost::iostreams::stream_offset off, std::ios_base::seekdir way)
	{
		return m_pFileHandle->seek(off, way);
	}

	void FileDevice::open(std::ios_base::openmode mode)
	{
		m_pFileHandle->open(mode);
	}

	bool FileDevice::is_open() const
	{
		return m_pFileHandle->is_open();
	}
	
	void FileDevice::close()
	{
		m_pFileHandle->close();
	}
} /*vfs*/} /*ja2*/
